<%@ page language="java" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/jsp/pub/include.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>产品信息管理--<c:choose><c:when test="${empty clazzEntity}">添加</c:when><c:otherwise>查看</c:otherwise></c:choose></title>
    <link href="<%=request.getContextPath() %>/css/admin.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/common.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.form.js"></script>
    <script type="text/javascript">
        function check(){
            var url = getRootPath()+"/clazz/addproduce?m=doadd";
            var   customer = $("#customer").val();
            var   producename = $("#producename").val();
            var   connector = $("#connector").val();
            var   connectorphone = $("#connectorphone").val();
            var   description = $("#description").val();
            var   billcode = $("#billcode").val();
            var   address = $("#address").val();
            var   telephone = $("#telephone").val();
            var   openaddress = $("#openaddress").val();
            var   opencode = $("#opencode").val();
            var   id = $("#id").val();
            if(customer==""){
                alert("客户名称不能为空");
                return false;
            }
            if(producename==""){
                alert("产品名不能为空");
                return false;
            }
            <c:if test="${not empty produceEntity}">
            url = getRootPath()+"/clazz/addproduce?m=doedit";
            </c:if>
            $('#permission').attr('disabled', false);
//            alert(6234);
            var para ={
                'id' :id,
                'customer':customer,
                'producename':producename,
                'connector' :connector,
                'connectorphone':connectorphone,
                'description':description,
                'billcode':billcode,
                'address':address,
                'telephone' :telephone,
                'openaddress':openaddress,
                'opencode':opencode
            }
//            alert(url);
            $.ajax({
                cache:false,
                type:"POST",
                url: url,
                dataType:"json",
                data:para,
                error:function(XMLHttpRequest, textStatus, errorThrown) {
                    alert(XMLHttpRequest.status);
                },
                success:function(returndata){
                    alert(returndata.data.message);
                    if(returndata.data.suc){
                        window.location.href= getRootPath()+"/clazz/produce?m=list";
                    }else{

                    }
                }
            });
        }
    </script>
</head>
<body>
<div class="content">
    <jsp:include page="../pub/top.jsp"></jsp:include>
    <!--头部结束-->
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td class="left" valign="top">
                <jsp:include page="../pub/left_clazz.jsp"></jsp:include>
            </td>
            <td valign="top">
                <div class="right">
                    <form id="addProduceFrom" action="<c:url value="/clazz/addproduce?m=doadd"/>" method="post" onsubmit="return check(this);" style="margin:0">
                        <table width="80%" border="0" cellpadding="0" cellspacing="1" bgcolor="#d1d5d8">
                            <tr>
                                <td height="28" colspan="2" bgcolor="#c6dbf8" class="biaoti" style="padding:0;">
                                    <c:choose>
                                        <c:when test="${empty produceEntity}">添加</c:when>
                                        <c:otherwise>查看</c:otherwise>
                                    </c:choose>
                                </td>
                            </tr>

                            <tr>
                                <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>产品名称：</td>
                                <td height="28" bgcolor="#FFFFFF"><input type="text" name="producename" id="producename" value="<c:out value="${produceEntity.producename}" />" /></td>
                            </tr>
                            <tr>
                                <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>客户公司名称：</td>
                                <td height="28" bgcolor="#FFFFFF">
                                    <input type="text" name="customer" id="customer" value="<c:out value="${produceEntity.customer}"/>" /></td>
                            </tr>
                            <tr>
                                <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>纳税人识别号：</td>
                                <td height="28" bgcolor="#FFFFFF">
                                    <input type="text" name="billcode" id="billcode" value="<c:out value="${produceEntity.billcode}"/>" /></td>
                            </tr>
                            <tr>
                                <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>开票注册地址：</td>
                                <td height="28" bgcolor="#FFFFFF">
                                    <input type="text" name="address" id="address" value="<c:out value="${produceEntity.address}"/>" /></td>
                            </tr>
                            <tr>
                                <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>开票电话：</td>
                                <td height="28" bgcolor="#FFFFFF">
                                    <input type="text" name="telephone" id="telephone" value="<c:out value="${produceEntity.telephone}"/>" /></td>
                            </tr>
                            <tr>
                                <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>开户行：</td>
                                <td height="28" bgcolor="#FFFFFF">
                                    <input type="text" name="openaddress" id="openaddress" value="<c:out value="${produceEntity.openaddress}"/>" /></td>
                            </tr>
                            <tr>
                                <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>开户账号*：</td>
                                <td height="28" bgcolor="#FFFFFF">
                                    <input type="text" name="opencode" id="opencode" value="<c:out value="${produceEntity.opencode}"/>" /></td>
                            </tr>
                            <tr>
                                <td width="15%" height="28" align="right" bgcolor="#edf1f7">对接联系人：</td>
                                <td height="28" bgcolor="#FFFFFF"><input type="text" name="connector" id="connector" value="<c:out value="${produceEntity.connector}" />" /></td>
                            </tr>
                            <tr>
                                <td width="15%" height="28" align="right" bgcolor="#edf1f7">联系电话：</td>
                                <td height="28" bgcolor="#FFFFFF"><input type="text" name="connectorphone" id="connectorphone" value="<c:out value="${produceEntity.connectorphone}" />" /></td>
                            </tr>
                            <tr>
                                <td width="15%" height="28" align="right" bgcolor="#edf1f7">产品描述：</td>
                                <td height="28" bgcolor="#FFFFFF"><textarea  name="description" id="description" style="width:200px;height:80px;" ><c:out value="${produceEntity.description}"/></textarea></td>
                            </tr>
                        </table>
                        <div class="anniu">
                            <%--<p><input type="button" value="提交" class="fabu" onclick="check()"/>--%>
                                <%--<c:choose>--%>
                                    <%--<c:when test="${empty produceEntity}"><input type="reset" value="重置" class="fabu" /></c:when>--%>
                                    <%--<c:otherwise><input type="button" value="返回" class="fabu" onclick="history.back()" /></c:otherwise>--%>
                                <%--</c:choose>--%>
                            <%--</p>--%>
                            <input type="hidden" name="id" id="id" value="${produceEntity.id}"/>
                        </div>
                    </form>
                </div>
                <br />
                <br />
            </td>
        </tr>
    </table>
    <jsp:include page="../pub/foot.jsp"></jsp:include>
</div>
</body>
</html>
